import request from '@/utils/http'
import type { IDefecateChart, IDefecateData } from './defecateModel'

// 获取排便列表
export function getDefecateListByEmpi(data: Pick<IDefecateData, 'empi'>) {
  return request.post({
    url: `/api/defecate/list?empi=${data.empi}`
  })
}

// 新增、编辑排便信息
export function saveDefecate(data: IDefecateData) {
  return request.post({
    url: `/api/defecate/save`,
    data
  })
}

// 删除排便信息
export function deleteDefecate(data: { id: string }) {
  return request.post({
    url: `/api/defecate/delete?id=${data.id}`
  })
}

// 获取排便信息
export function getDefecateById(data: { id: string }) {
  return request.get({
    url: `/api/defecate/info`,
    data
  })
}

// 获取排便图表信息
export const defecateInfo = (data: IDefecateChart) => {
  return request.post({
    url: '/api/defecate/chat',
    data
  })
}
